package za.co.pas.spaceandtime.model.list;

import java.util.LinkedList;
import java.util.List;
import javax.swing.ListModel;
import javax.swing.event.ListDataListener;
import za.co.pas.spaceandtime.data.Building;

public class BuildingListModel implements ListModel
{
    private List<Building> buildings = new LinkedList<Building>();
    @Override
    public int getSize()
    {
        if(getBuildings() == null)
        {
            return 0;
        }
        return getBuildings().size();
    }

    @Override
    public Object getElementAt(int index)
    {
        if(getBuildings() == null)
        {
            return null;
        }
        return buildings.get(index);
    }

    @Override
    public void addListDataListener(ListDataListener l)
    {
        
    }

    @Override
    public void removeListDataListener(ListDataListener l)
    {
        
    }

    
    /**
     * @return the buildings
     */
    public List<Building> getBuildings()
    {
        return buildings;
    }

    /**
     * @param buildings the buildings to set
     */
    public void setBuildings(List<Building> buildings)
    {
        this.buildings = buildings;
    }

}
